package com.sunbim.rsrv.config;

import cn.dev33.satoken.stp.StpInterface;
import com.sunbim.rsrv.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;


/**
 * SaToken 用户权限配置
 */
@Component
public class SaTokenAuthConfig implements StpInterface {
    @Autowired
    UserMapper userMapper;

    @Override
    public List<String> getPermissionList(Object o, String s) {
        return null;
    }

    /**
     * 获取用户的role列表
     *
     * @param o
     * @param s
     * @return
     */
    @Override
    public List<String> getRoleList(Object o, String s) {
        // 用户存在，查找角色
        return userMapper.getRoleById(o);
    }
}
